import instance from '@/utils/http'

// 获取一级分类列表
export const findTopCategoryAPI = (id) => {
    return instance({
        url: '/category',
        params: {
            id
        }
    })
}

// 获取二级导航分类数据
export const getCategoryFilterAPI = (id) => {
    return instance({
        url: '/category/sub/filter',
        params: {
            id
        }
    })
}

/**
 * @description: 获取导航数据
 * @data {
 *  categoryId: 1005000 ,
 *  page: 1,
 *  pageSize: 20,
 *  sortField: 'publishTime' | 'orderNum' | 'evaluateNum'
 }
 * @return {*}
 */
export const getSubCategoryAPI = (data) => {
    return instance({
        url: '/category/goods/temporary',
        method: 'POST',
        data
    })
}